﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.woodsoft.core;
using com.woodsoft.core.Files;
using EQ1.Elements;
using EQ1.Objects;

namespace EQ1.Controls {
  public class FinderBox :VerticalLayoutBox, IUIElement<FinderBox>{
    public FinderBox ( UIDocument doc , string name ) : base( doc , name ) {
    }
    public FinderBox ( UIDocument doc ) : this( doc , "FinderBox" ) {
    }

    #region IUIElement<FinderBox> Members

    public void Validate ( FinderBox val , string name ) {
      UIClass par = ( UIClass ) this.ParentNode;

      if( val.LocalName != name ) {
        FinderBox el = new FinderBox( ( UIDocument ) val.OwnerDocument , name );
        el.Copy( val );
        val = el;
      }

      if( par.GetElement( name ) != null )
        par.RemoveElement( name );

      par.AppendChild( val );
    }

    public void Copy ( FinderBox val ) {
      base.Copy( val );
    }

    #endregion
  }
}
